package com.altekis.kanbankaze.shared;

import java.util.Date;
import java.util.List;

import javax.jdo.annotations.Element;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable
public class UserStory {

	@Persistent(mappedBy = "userStory")
	@Element(dependent = "true")
	protected List<AcceptanceTest> acceptanceTests;
	@Persistent
	private Long board;
	@Persistent
	private Date createDate;
	@Persistent
	private String description;
	@Persistent
	@PrimaryKey
	private Long id;
	@Persistent
	private Date modificationDate;
	@Persistent
	private String name;
	@Persistent
	private int priority;
	@Persistent(mappedBy = "userStory")
	@Element(dependent = "true")
	protected List<Task> tasks;

	/**
	 * All field constructor. Except for the children objects and the
	 * auto-computed ones.
	 * 
	 * @param board
	 * @param createDate
	 * @param description
	 * @param id
	 * @param modificationDate
	 * @param name
	 * @param priority
	 */
	public UserStory(Long board, String description, Long id, String name,
			int priority) {
		this.board = board;
		this.createDate = new Date();
		this.description = description;
		this.id = id;
		this.modificationDate = new Date();
		this.name = name;
		this.priority = priority;
	}

	/**
	 * @return the acceptanceTests
	 */
	public List<AcceptanceTest> getAcceptanceTests() {
		return acceptanceTests;
	}

	/**
	 * @return the board
	 */
	public Long getBoard() {
		return board;
	}

	/**
	 * @return the createDate
	 */
	public Date getCreateDate() {
		return createDate;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @return the modificationDate
	 */
	public Date getModificationDate() {
		return modificationDate;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the priority
	 */
	public int getPriority() {
		return priority;
	}

	/**
	 * @return the tasks
	 */
	public List<Task> getTasks() {
		return tasks;
	}

	/**
	 * @param acceptanceTests
	 *            the acceptanceTests to set
	 */
	public void setAcceptanceTests(List<AcceptanceTest> acceptanceTests) {
		this.acceptanceTests = acceptanceTests;
	}

	/**
	 * @param board
	 *            the board to set
	 */
	public void setBoard(Long board) {
		this.board = board;
	}

	/**
	 * @param createDate
	 *            the createDate to set
	 */
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @param modificationDate
	 *            the modificationDate to set
	 */
	public void setModificationDate(Date modificationDate) {
		this.modificationDate = modificationDate;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @param priority
	 *            the priority to set
	 */
	public void setPriority(int priority) {
		this.priority = priority;
	}

	/**
	 * @param tasks
	 *            the tasks to set
	 */
	public void setTasks(List<Task> tasks) {
		this.tasks = tasks;
	}

}
